package com.kjsb.service.impl;

import com.kjsb.dao.UserDao;
import com.kjsb.entity.User;
import com.kjsb.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author li xiaoYu
 * @data 2022年 11月 23日12:46
 */
@Service
public class UserServiceImpl implements UserService {
    @Autowired
    private UserDao userDao;

    @Override
    public boolean login(String username,String password) {
        User user = userDao.login(username,password);
        return user!=null;
    }

    @Override
    public List<User> getAllUsers() {
        return userDao.selectList(null);
    }

    @Override
    public boolean deleteUsers(Integer id) {
        userDao.deleteById(id);
        return true;
    }

    @Override
    public boolean saveUsers(User user) {
        userDao.insert(user);
        return true;
    }

    @Override
    public boolean updateExpertPassword(User user) {
        userDao.updateById(user);
        return false;
    }

    @Override
    public boolean updateUnitPassword(User user) {
        return false;
    }
}
